package com.ajr.core;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;

import org.apache.log4j.Logger;

import com.ajr.core.visma.VismaEnvironment;

public class OrderObject {
	static Logger logger = Logger.getLogger(OrderObject.class); 

	String customerNumber;
	int customerOrderNumber;
	String currency;
	double currencyValue = 0;
	
	String paymentMethod;
	
	OrderDetails orderDetails;
	
	String billingReference;
	
	Date orderDate;
	
	
	public Date getOrderDate() {
		return orderDate;
	}
	public void setOrderDate(Date orderDate) {
		this.orderDate = orderDate;
	}
	public String getBillingReference() {
		return billingReference;
	}
	public void setBillingReference(String billingReference) {
		this.billingReference = billingReference;
	}
	public OrderDetails getOrderDetails() {
		return orderDetails;
	}
	public void setOrderDetails(OrderDetails orderDetails) {
		this.orderDetails = orderDetails;
	}
	public String getPaymentMethod() {
		return VismaEnvironment.getInstance().getPaymentCodes(paymentMethod);
	}
	
	public String getPaymentMethodAsItIs() {
		return paymentMethod;
	}
	
	public void setPaymentMethod(String paymentMethod) {
		this.paymentMethod = paymentMethod;
	}
	public String getCurrency() {
		return currency;
	}
	public void setCurrency(String currency) {
		this.currency = currency;
	}
	public double getCurrencyValue() {
		return currencyValue;
	}
	public void setCurrencyValue(double currencyValue) {
		this.currencyValue = currencyValue;
	}
//	ArrayList aritcleList = new ArrayList();
	ArrayList aritcleObjectList = new ArrayList();
	public ArrayList getAritcleObjectList() {
		return aritcleObjectList;
	}
	/*public void setAritcleObjectList(ArrayList aritcleObjectList) {
		this.aritcleObjectList = aritcleObjectList;
	}*/
//	ArrayList quantityList = new ArrayList();
	/*public ArrayList getQuantityList() {
		return quantityList;
	}*/
	public int getCustomerOrderNumber() {
		return customerOrderNumber;
	}
	public void setCustomerOrderNumber(int customerOrderNumber) {
		this.customerOrderNumber = customerOrderNumber;
	}
	public String getCustomerNumber() {
		return customerNumber;
	}
	public void setCustomerNumber(String customerNumber) {
		this.customerNumber = customerNumber;
	}

	public void addArticleNumber(ArticleObject articleObject) {
			aritcleObjectList.add(articleObject);
	}
	public int getOrderRowSize(boolean inclueAttributes) {
		int size = 0;
		for (Iterator iterator = aritcleObjectList.iterator(); iterator.hasNext();) {
			ArticleObject type = (ArticleObject) iterator.next();
			size++;
			if(inclueAttributes) {
				size += type.getOrderProductAttributes().getOptionsSize();
			}
		}
		return size;
	}
	
	String economic_unit;
	public String getEconomic_unit() {
		return economic_unit;
	}

	public void setEconomic_unit(String economicUnit) {
		economic_unit = economicUnit;
	}

	
	/*public void addArticleNumber(int articleNumber,int quantity,ArticleObject articleObject) {
		if(!aritcleList.contains(articleNumber)) {
			aritcleList.add(articleNumber);
			quantityList.add(quantity);
			aritcleObjectList.add(articleObject);
		}
		
	}*/
	/*public ArrayList getAritcleList() {
		return aritcleList;
	}*/

}
